<template>
	<view class="page" :style="loading ? 'opacity: 0;' : 'opacity: 1;'">
		<!--  v-model="dataList" @query="queryList" -->
		<pageTxt>
			<z-paging ref="paging" :paging-style="{ 'background-color': '#f7f7f7', height: '100%', width: '100%' }">
				<!-- 头部 -->
				<template slot="top">
					<view class="navbar-box">
						<u-navbar title="现场反馈" :autoBack="true" :fixed="false"></u-navbar>
					</view>
				</template>
				<view class="add-content ios">
					<u--form labelPosition="top" :model="formData" ref="uForm" labelWidth="auto">
						<view class="form-box">
							<u-form-item required label="是否需要集采订货" borderBottom>
								<u-radio-group v-model="formData.is_order_goods" placement="row">
									<u-radio label="需要" :name="1"></u-radio>
									<u-radio label="不需要" :name="2"></u-radio>
								</u-radio-group>
							</u-form-item>

							<u-form-item required label="订单需求(明细)" borderBottom v-if="formData.is_order_goods == 1">
								<u--textarea disableDefaultPadding v-model="formData.order_demand" border="none"
									placeholder="请输入订单需求(明细)" :placeholderStyle="{fontSize: '13.5px', color: '#BFC4CC'}"></u--textarea>
							</u-form-item>

							<u-form-item required label="现场核实照片">
								<file-upload :filesList="list" :typeList="['m﻿4a', 'mp3', 'zip', 'rar']" @afterRead="afterRead"
									@delete="deletePic"></file-upload>
							</u-form-item>
						</view>
					</u--form>
				</view>
				<view class="footer ios">
					<u-button text="提交" @click="submit"
						customStyle="width: 702rpx;height: 88rpx;background: #3B75FF;border-radius: 16rpx;font-weight: 500;font-size: 28rpx;color: #FFFFFF;margin:20rpx 24rpx;"></u-button>
				</view>
			</z-paging>
		</pageTxt>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				loading: false,
				list: [],
				formData: {
					id: '',
					is_order_goods: 1,
					order_demand: '',
					site_file: []
				},
			};
		},
		onLoad() {
			setTimeout(() => {
				this.list.push({
					expense_voucher_id: 395,
					file_id: 427,
					file_name: "枫叶_1.jpg",
					file_suffix: "jpg",
					file_url: "https://hzybucket.obs.cn-south-1.myhuaweicloud.com:443/expense_voucher/20250310094558_枫叶_1.jpg",
					name: "枫叶_1.jpg",
					project_id: 0,
					src: "https://hzybucket.obs.cn-south-1.myhuaweicloud.com:443/expense_voucher/20250310094558_枫叶_1.jpg",
					state: 100
				})
			}, 300)
		},
		methods: {
			afterRead(files) {
				files.map(item => {
					let obj = {
						url: item.url
					}
					this.formData.site_file.push(obj)
					console.log(this.formData.site_file, 'afterRead');
				})
			},
			deletePic(e) {
				console.log(e, 'deletePic');
				this.formData.site_file.splice(e.index, 1)
			},
			submit() {

			},

		}
	};
</script>

<style lang="scss" scoped></style>